// 通知动画
export default function notice(text='测试',duration=3000) {
  if ($('#LQ-notice').length>=1) {return;}
  var p = document.createElement('p');
  var div = document.createElement('div');
  $(div).append(p);
  $(div).attr('id','LQ-notice');
  $(p).css({
    color:'#fff',
    backgroundColor:'rgba(0,0,0,.8)',
    padding:'.12rem .18rem',
    lineHeight:'.13rem',
    display:'inline-block',
    fontSize:'.13rem',
    textAlign:'center',
    margin:'0 auto',
    borderRadius:'.19rem',
    fontFamily:'PingFang SC'
  }).text(text);
  $('body').append(div);
  $('#LQ-notice').css({
    position:'fixed',
    top:'calc(50% - .15rem)',
    textAlign:'center',
    lineHeight:'.3rem',
    maxWidth:"70%"
  });
  $('#LQ-notice').css({
    left:`calc(50% - ${($("#LQ-notice").width()/100/2).toFixed(2)}rem)`
  });
  $('#LQ-notice').fadeIn();
  setTimeout(function () {
    $('#LQ-notice').fadeOut().remove();
  },duration)
};